import nltk


fr = open('../data/clean-data/positives.txt', 'r')
fw = open('../data/bigram-data/positives.txt', 'w')

for line in fr.readlines():
    line = line.strip('\n')
    line = line.rstrip('.')
    line = nltk.word_tokenize(line)
    line = nltk.bigrams(line)
    line = ' '.join([nltk.tag.tuple2str(w) for w in line])
    fw.write(line + '.' + '\n')

fr.close()
fw.close()

fr = open('../data/clean-data/negatives.txt', 'r')
fw = open('../data/bigram-data/negatives.txt', 'w')

for line in fr.readlines():
    line = line.strip('\n')
    line = line.rstrip('.')
    line = nltk.word_tokenize(line)
    line = nltk.bigrams(line)
    line = ' '.join([nltk.tag.tuple2str(w) for w in line])
    fw.write(line + '.' + '\n')

fr.close()
fw.close()
